const api = require('../config/config').api,
	Model = require('../lib/Model');

//模型层管理请求到的数据
//该子类模型层继承父类的get/post方法
class IndexModel extends Model {
	getXiaomiDatas(options) {
		const swiper = options.swiper,
			phone = options.phone,
			field = options.field;

		const url = `${api.getXiaomiDatas}?swiper=${swiper}&phone=${phone}&field=${field}`;

		//返回继承父类的get方法
		return this.get(url, {
			success(res) {
				return res;
			},

			error(error) {
				throw new Error('Error: ' + error);
			}
		});
	}
}

module.exports = new IndexModel();